<extend name="layout/base"/>
<block name="title"><title>{$article.title}-{$confs.site.title_second}</title></block>
<block name="description"><meta name="description" content="{$article.abstract}"></block>
<block name="css">
    <link rel="stylesheet" href="/static/vendor/editor.md/css/editormd.css" />
    <style>
        .editormd-preview-container, .editormd-html-preview {
            padding: 0;
        }
    </style>
</block>
<!--lbox begin-->
<block name="l">
    <div class="lbox">
        <div class="content_box whitebg">
            <h2 class="htitle"><span class="con_nav">您现在的位置是：<a href="/">首页</a>&nbsp;>&nbsp;<a
                    href="{:url($article.newsCategory.route_name,['page'=>1])}">{$article.newsCategory.title}</a></span>{$article.newsCategory.title}</h2>
            <h1 class="con_tilte">{$article.title}</h1>
            <p class="bloginfo">
                <i class="avatar"><img src="/static/picture/avatar.jpg"></i>
                <span>上善若水</span><span>{$article.create_time}</span><span>【{$article.newsCategory.title}】</span>
                <span>{$article.browse}人已围观</span>
            </p>
            <p class="con_info"><b>简介</b>{$article.abstract}</p>
            <div class="con_text">
                <div id="my-content">
                    {$article.content|raw}
                </div>
                <notempty name='article.tags'>
                    <p>Tags：
                        <volist name="article.tags" id="vo">
                            <a href="{:url('tag.index',['name'=>$vo.name,'page'=>1])}">{$vo.name}</a>
                        </volist>
                    </p>
                </notempty>
                <p class="share"><b>转载：</b>感谢您对思议岁月个人博客网站平台的认可，以及对我们原创作品以及文章的青睐，非常欢迎各位朋友分享到个人站长或者朋友圈，但转载请说明文章出处“来源思议岁月个人博客”。</p>
                <p><span class="diggit">
                <a href="javascript:;" data-id="{$article.id}" id="diggnum"> 很赞哦！ </a>(<b id="diggnum_b">{$article.up}</b>)</span>
                </p>
                <div class="nextinfo">
                    <p>上一篇：<empty name='up_article' >
                        <span>没有上一篇</span>
                        <else />
                        <a href="{:url('article.index',['id'=>$up_article.id])}">{$up_article.title}</a>
                    </empty>
                    </p>
                    <p>下一篇：<empty name='down_article'>
                        <span>没有下一篇</span>
                        <else />
                        <a href="{:url('article.index',['id'=>$down_article.id])}">{$down_article.title}</a>
                    </empty>
                    </p>
                </div>
            </div>
        </div>
        <div class="whitebg">
            <h2 class="htitle">相关文章</h2>
            <ul class="otherlink">
                <volist name="relevant_news" id="vo">
                    <li><a href="{:url('article.index',['id'=>$vo.id])}" title="{$vo.title}" target="_blank">{$vo.title}</a></li>
                </volist>
            </ul>
        </div>
        <div class="whitebg">
            <h2 class="htitle">随机图文</h2>
            <ul class="xiangsi">
                <volist name="rand_news" id="vo">
                    <li><a href="{:url('article.index',['id'=>$vo.id])}" target="_blank"><i><img
                            src="{$vo.cover}"></i>
                        <p>{$vo.title}</p>
                        <span>{$vo.abstract}</span></a>
                    </li>
                </volist>
            </ul>
        </div>

        <div class="whitebg gbook">
            <h2 class="htitle">文章评论</h2>
            <ul>
                <volist name="article.comments" id="vo">
                    <div class="fb"><ul><p class="fbtime"><span>{$vo.create_time}</span> {$vo.username}</p><p class="fbinfo">{$vo.content}</p></ul></div>
                </volist>
                <form action="/comment/add" method="post" name="saypl" id="saypl">
                    <div id="plpost">
                        <p class="saying"><span><a href="javascript:;">共有{$article.comments_count}条评论</a></span>来说两句吧...</p>
                        <p class="yname"><span>用户名:</span>
                            <input name="username" type="text" class="inputText" id="username" value="" size="16">
                        </p>
                        <p class="yzm"><span>验证码:</span>
                            <input name="captcha" type="text" class="inputText" size="16" id="captcha">
                            <img src="/article/verify" align="absmiddle" alt="captcha" id="plKeyImg" title="看不清楚,点击刷新">
                        </p>
                        <textarea name="content" rows="6" id="saytext"></textarea>
                        <input name="news_id" type="hidden" value="{$article.id}" id="news_id">
                        <input type="submit" class="submit_comment" value="提交">
                    </div>
                </form>
            </ul>
        </div>
    </div>
</block>
<block name="r">
    <div class="rbox">
        {$sidebar->render()|raw}
    </div>
</block>

<block name="js">
    <script src="/static/vendor/editor.md/editormd.js"></script>
    <script src="/static/vendor/editor.md/lib/marked.min.js"></script>
    <script src="/static/vendor/editor.md//lib/prettify.min.js"></script>
    <script>
        $(function () {
            editormd.markdownToHTML("my-content");

            $('#diggnum').click(function () {
                var $_this=$(this);
                var already=$_this.attr('already');
                if(already){
                    alert('你已经赞过该文章了，谢谢支持！');
                }else {
                    var id=$_this.data('id');
                    $.get('/article/zan',{id:id},function () {
                        var $b=$('#diggnum_b');
                        $_this.attr('already','true');
                        $b.text(parseInt($b.text())+1);
                        alert('点赞成功，谢谢支持！');
                    });
                }
            });
            $('#plKeyImg').click(function () {
                $(this).attr('src','/article/verify?rand='+Math.random())
            });
            $('.submit_comment').click(function () {
                var username=$('#username').val();
                var captcha=$('#captcha').val();
                var content=$('#saytext').val();
                var news_id=$('#news_id').val();
                var json={username:username,captcha:captcha,content:content,news_id:news_id};
                $.post('/comment/add',json,function (res) {
                    if(res.code==0){
                        alert('提交成功！');
                        window.location.reload();
                    }else {
                        alert(res.msg);
                        $('#plKeyImg').click();
                    }
                })
                return false;
            });
        })
    </script>
</block>